<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8" />
        <title>用户登录</title>
        <link rel="stylesheet" type="text/css" href="/bower_components/bootstrap/dist/css/bootstrap.css">
        <script type="text/javascript" src="//cdn.bootcss.com/jquery/1.12.4/jquery.min.js"></script>
    <body>
	    <div class="container">
	        <div class="row">
	        	<div class="col-md-4 col-md-offset-4">
        			<div class="page-header">
			    		登陆  &nbsp;<a href="/users/sign">注册</a>
			        </div>
			        <form>
	        			<div class="form-group">
	        				<label>用户名</label>
	        				<input type="text" name="username" class="form-control" placeholder="请输入用户名">
	        			</div>
	        			<div class="form-group">
	        				<label>密码</label>
	        				<input type="password" name="password" class="form-control" placeholder="请输入密码">
	        			</div>
	        			<button id="aaa" type="button" class="btn btn-success">提交</button>
        			</form>
	        	</div>
	        </div>
        </div>
        <script type="text/javascript">
        		$("#aaa").click(function(){
  					 $.post("/users/dologin",
						{
					    name:$("input[name='username']").val(),
					    password:$("input[name='password']").val(),
						},
						function(data,status){
						if (data=='ok') {
							window.location.href='/admin'
						}else{
							alert(data);
						}
					})
				})
        </script>
    </body>
</html>
